package org.example;

import org.example.listener.PdfPageEventListener;
import org.example.vo.Order;

import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;

public class Main {



    public static void main(String[] args) throws IOException {
        Order order = new Order();
        order.setCity("广州");
        PdfCreator creator = new PdfCreator();
        PdfPageEventListener listener = PdfPageEventListener.build().setHeaderText("互联网联合运营管理总局").build();
        Map<String, Object> map = new HashMap<>();
        map.put("data", order);
        ByteArrayOutputStream outputStream = creator.init(listener).creator(map);
        OutputStream output = new FileOutputStream("D:\\pdf\\openPdf.pdf");
        outputStream.writeTo(output);
        output.flush();
        output.close();
    }

}